package com.wyait.manage.config.security.encoder;

import com.wyait.manage.utils.MD5Util;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * Package: com.wyait.manage.config.security.encoder
 * Description：
 * Author: huangjian
 * Date:  2020/9/12 14:41
 * Modified By:
 * @author huangjian
 */
public class MD5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return MD5Util.encode((String)rawPassword);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5Util.encode((String)rawPassword));
    }
}
